//
//  FloatUtil.m
//  Rong360
//
//  Created by tianliwei on 16/2/14.
//  Copyright (c) 2014 tianliwei. All rights reserved.
//

#import "FloatUtil.h"

@implementation FloatUtil
+ (NSString *)roundUp:(float)number afterPoint:(int)position{
    NSDecimalNumberHandler* roundingBehavior = [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundUp scale:position raiseOnExactness:NO raiseOnOverflow:NO raiseOnUnderflow:NO raiseOnDivideByZero:NO];
    NSDecimalNumber *ouncesDecimal;
    NSDecimalNumber *roundedOunces;
    ouncesDecimal = [[NSDecimalNumber alloc] initWithFloat:number];
    roundedOunces = [ouncesDecimal decimalNumberByRoundingAccordingToBehavior:roundingBehavior];
    return [NSString stringWithFormat:@"%@",roundedOunces];
}

+ (NSString *)stringFromFloat:(CGFloat)f{
    return [NSString stringWithFormat:@"%.2lf",f];
}
@end
